﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Data.SqlClient;

namespace Hotel_Management.Manager
{
    public partial class ManagerMainMenu : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //Połączenie z bazą danych
            try
            {
                SqlConnection connection = new SqlConnection("workstation id=pzppath2.mssql.somee.com;packet size=4096;user id=powel13_SQLLogin_1;pwd=8jraxuhqm4;data source=pzppath2.mssql.somee.com;persist security info=False;initial catalog=pzppath2");

                connection.Open();
                dbAccessLabel.Text = "Baza danych działa poprawnie";
                dbAccessImg.ImageUrl = "http://t3.gstatic.com/images?q=tbn:ANd9GcTfJfvC6y4z_-O-k5j1sgM5jbPiyR2Kd79fxeprnV_vbm2YkA4m6JsssVM";
                dbAccessImg.Width = 20;
                dbAccessImg.Height = 20;
            }
            catch (Exception ex)
            {
                dbAccessLabel.Text = "Błąd połączenia z bazą ! Error:  " + ex.Message;
                dbAccessImg.ImageUrl = "http://t2.gstatic.com/images?q=tbn:ANd9GcQLEJcdEp2Avk3-GTHV0mBCHAHVIUN0ic40xuX6vL7RSmKG_rgfDkAv1pQ";
                dbAccessImg.Width = 20;
                dbAccessImg.Height = 20;
            }

            //ZAlogowany user

            try
            {
                //loginLabel.Text += Membership.GetUser().UserName;
            }
            catch (Exception ex)
            {
                loginLabel.Text = ex.Message;
            }
        }

        protected void logoffButon_Click(object sender, EventArgs e)
        {
            //Wylogowywanie
            try
            {
                FormsAuthentication.SignOut();

            }
            catch (Exception ex)
            {

            }
        }
    }
}